#!/bin/bash
num=1
iNum=1
echo $$

run=$1

$run

while(true)
do
    sn=`ps -ef | grep ./gameserver | grep -v grep |awk '{print $2}'`
    echo $sn
    if [ "${sn}" = "" ]    #如果为空,表示进程未启动
    then
        let "iNum++"
        echo $iNum

        echo start ok !
    else
        echo running
    fi
    sleep 1
done